﻿Ext.define('Happy.cms.article.metadata.Metadata', {
    extend: 'Happy.metadata.Metadata',
    singleton: true,
    requires: [,
       'Happy.cms.category.metadata.Metadata',
       'Happy.cms.tag.metadata.Metadata'
    ],

    constructor: function () {
        var me = this;

        me.data = {
            namespace: 'Happy.cms',
            name: 'Article',
            plural: 'Articles',
            urlPrefix: 'Happy/Cms',
            displayName: '文章',
            summaryProperty: 'Title',
            form: {
                width: 960,
                height: 600
            },
            properties: {
                Id: {
                    name: 'Id',
                    dataType: "Guid"
                },
                OptimisticKey: {
                    name: 'OptimisticKey',
                    dataType: "String"
                },
                Title: {
                    name: 'Title',
                    dataType: "String",
                    displayName: '标题'
                },
                CategoryId: {
                    name: 'CategoryId',
                    dataType: "Guid",
                    displayName: '分类',
                    showInGrid: false,
                    foreignReference: {
                        metadata: Happy.cms.category.metadata.Metadata
                    },
                    editorConfig: { rootVisible: false },
                    editorConfigFns: [
                        Happy.metadata.EditorConfigFns.treeComboBoxConfigFn
                    ]
                },
                Author: {
                    name: 'Author',
                    dataType: "String",
                    displayName: '作者'
                },
                ImageInfo_Title: {
                    name: 'ImageInfo_Title',
                    dataType: "String",
                    displayName: '图片标题'
                },
                ImageInfo_Url: {
                    name: 'ImageInfo_Url',
                    dataType: "String",
                    displayName: '图片地址',
                    editorConfig: {
                        xtype: 'happy-imagecontainer'
                    }
                },
                SettingInfo_Published: {
                    name: 'SettingInfo_Published',
                    dataType: "Bool",
                    displayName: '是否发布'
                },
                SettingInfo_ShowInTop: {
                    name: 'SettingInfo_ShowInTop',
                    dataType: "Bool",
                    displayName: '首页显示'
                },
                AssignedTags: {
                    name: 'AssignedTags',
                    dataType: "Complex",
                    displayName: '标签',
                    editorConfig: {
                        xtype: 'happy-checkboxgroup',
                        storeConfig: {
                            type: Happy.cms.tag.metadata.Metadata.getStoreClassName(),
                            autoLoad: true
                        }
                    }
                },
                Content: {
                    name: 'Content',
                    dataType: "String",
                    displayName: '内容',
                    showInGrid: false,
                    editorConfig: {
                        xtype: 'happy-ckeditor'
                    }
                },
                PublishDate: {
                    name: 'PublishDate',
                    dataType: "Datetime",
                    displayName: '发布日期' 
                },
                SeoInfo_Title: {
                    name: 'SeoInfo_Title',
                    dataType: "String",
                    displayName: 'SEO 标题'
                },
                SeoInfo_KeyWord: {
                    name: 'SeoInfo_KeyWord',
                    dataType: "String",
                    displayName: 'SEO 关键字'
                },
                SeoInfo_Description: {
                    name: 'SeoInfo_Description',
                    dataType: "String",
                    displayName: 'SEO 描述'
                },
                Order: {
                    name: 'Order',
                    dataType: "Int"
                }
            }
        };

        me.rules = ['aggregate-root', 'orderable'];

        me.callParent(arguments);
    }
});